<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="thx" uri="/thx-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page import="com.thx.common.util.AppContext"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + path + "/";
	com.topdt.jbpm.model.FlowDetail detail = (com.topdt.jbpm.model.FlowDetail) request
			.getAttribute("flowDetail");
	String json = "";
	String flowId = "";
	String detailId = "";
	String comId = "";
	if (detail != null) {
		flowId = detail.getFlowId();
		flowId = flowId == null ? "" : flowId;
		detailId = detail.getDetailId();
		detailId = detailId == null ? "" : detailId;
		comId = detail.getCompanyId();
		comId = comId == null ? "" : comId;
		json = detail.getJsonStr();
		json = json == null ? "" : json;
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>编辑流程</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/scripts/lib/zTree/css/metroStyle/metroStyle.css"/>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/AdminLTE/AdminLTE.min.css" />
		<link href="${pageContext.request.contextPath}/css/common.css" rel="stylesheet"/>
		<link href="${pageContext.request.contextPath}/scripts/lib/iCheck/all.css" rel="stylesheet"/>
		
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/workflow/flowDefin/css/definflow.css"/>	
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/theme/<%=AppContext.getProperties("systemcolor")%>/css/page.css" />
		
		<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/lib/jquery/jquery.min.js" ></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/lib/jquery-ui/jquery-ui-1.10.3.custom.js" ></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/lib/jquery-form/jquery.form.js" ></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/lib/zTree/js/jquery.ztree.all.min.js" ></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/lib/bootstrap/bootstrap.min.js" ></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/dialog.js" ></script>
		
		<script type="text/javascript" src="${pageContext.request.contextPath}/workflow/flowDefin/js/raphael-min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/workflow/flowDefin/js/topdtFlow.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/workflow/flowDefin/js/topdtFlow.jpdl4.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/workflow/flowDefin/js/topdtFlow.editors.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/workflow/flowDefin/js/handler.js"></script>
		<script src="${pageContext.request.contextPath}/scripts/util.js" ></script>
		<script src="${pageContext.request.contextPath}/scripts/lib/iCheck/icheck.min.js" ></script>
		<script src="${pageContext.request.contextPath}/scripts/icheck.js" ></script>
		<!-- 表单验证脚本开始-->
		<script src="${pageContext.request.contextPath}/scripts/lib/jquery-form/jquery.form.js" ></script>
		<script src="${pageContext.request.contextPath}/scripts/lib/jquery-validation/jquery.validate.js" ></script>
		<script src="${pageContext.request.contextPath}/scripts/lib/jquery-validation/extendValidate.js" ></script>
		<script src="${pageContext.request.contextPath}/scripts/form.js" ></script>
		<!-- 表单验证脚本结束-->
		<script type="text/javascript">
		    jsBaskPath="<%=path%>";
		    var detailId = "<%=detailId%>";
		    var flow_id = "<%=flowId%>";
			$(function() {
				$("#myflow").myflow({
					basePath : "${pageContext.request.contextPath}/workflow/flowDefin/",
					<%if(json!=null && !"".equals(json)){%>
					restore : eval("(<%=json%>)"),
					<%}%>
					tools : {
						save : {
							onclick : function(data) {
								save(data);
							}
						},
						xmlSrc:{
							onclick : function(data) {
								showXml(data);
							}
						},
						jsonSrc:{
							onclick : function(data) {
								showJson(data);
							}
						}
					}
				});
				$("#myflow_actor_setting").draggable().tabs();
				$("#myflow_condition_setting").draggable().tabs();
				$("#showJsonSource").draggable().tabs();
				$("#showXmlSource").draggable().tabs();
				$("#selectRole_Per").draggable().tabs();
			});
		</script>
	</head>
	<body>
		<div id="rightMenu" class="rightMenu">
			<ul>
		    	<li class="delElement">删除</li>
		    	<li class="turnLeft">向左对齐</li>
		    	<li class="turnRight">向右对齐</li>
		    	<li class="turnTop">向上对齐</li>
		    	<li class="turnBottom">向下对齐</li>
	    	</ul>
		</div>
		<div id="myflow_tools"	class="ui-widget-content">
			<div id="myflow_tools_handle" class="ui-widget-header">工具集</div>
			<div class="node" id="myflow_save">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/save.gif" />&nbsp;&nbsp;保存<br/>
			</div>
			<div class="node" id="myflow_saveAs" onclick="javascript:copyFlowDetail()" title="另存为">
					<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/saveAs.gif" />&nbsp;&nbsp;另存为
			</div>
			<div class="node" id="myflow_xml">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/xml.gif" />&nbsp;&nbsp;xml源码
			</div>
			<div class="node" id="myflow_json">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/json.gif" />&nbsp;&nbsp;json源码
			</div>
			<div>
				<hr/>
			</div>
			<div class="node selectable" id="pointer">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/select16.gif" />&nbsp;&nbsp;选择
			</div>
			<div class="node selectable" id="path">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/flow_sequence.png" />&nbsp;&nbsp;路径
			</div>
			<div>
				<hr/>
			</div>
			<div class="node state" id="start" type="start">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/start_event_empty.png" />&nbsp;&nbsp;开始
			</div>
			<div class="node state" id="task" type="task">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/task_empty.png" />&nbsp;&nbsp;任务
			</div>
			<!-- 
			<div class="node state" id="task" type="task">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/task_empty.png" />&nbsp;&nbsp;决策
			</div>
			 -->
			<div class="node state" id="fork" type="fork">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/gateway_parallel.png" />&nbsp;&nbsp;分支
			</div>
			<div class="node state" id="join" type="join">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/gateway_parallel.png" />&nbsp;&nbsp;合并
			</div>
			<!-- add by calonlan -->
			<div class="node state" id="decision" type="decision">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/gateway_exclusive.png" />&nbsp;&nbsp;决定
			</div>
			<div class="node state" id="foreach" type="foreach">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/gateway_parallel.png" />&nbsp;&nbsp;动态分支
			</div>
			<div class="node state" id="loopjoin" type="loopjoin">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/gateway_parallel.png" />&nbsp;&nbsp;动态合并
			</div>
			<div class="node state" id="end" type="end">
				<img src="${pageContext.request.contextPath}/workflow/flowDefin/img/16/end_event_terminate.png" />&nbsp;&nbsp;结束
			</div>
			<!--<div class="node state" id="state" type="state">
				<img src="img/16/task_empty.png" />&nbsp;&nbsp;状态
			</div>
			<div class="node state" id="end-cancel" type="end-cancel">
				<img src="img/16/end_event_cancel.png" />&nbsp;&nbsp;取消
			</div>
			<div class="node state" id="end-error" type="end-error">
				<img src="img/16/end_event_error.png" />&nbsp;&nbsp;错误
			</div>-->
		</div>
	
		<div id="myflow_props" class="ui-widget-content">
			<div id="myflow_props_handle" class="ui-widget-header">属性</div>
			<table border="1" style="width:230px;margin:8px;border:1px solid #3c8dbc" cellpadding="0" cellspacing="0">
			</table>
			<div>&nbsp;</div>
		</div>
		<div class="myflow-wrap"><div id="myflow"></div></div>
	</body>
</html>